/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.farmcode.console.api.business;

import com.farmcode.base.dao.BaseFilter;
import com.farmcode.base.dao.DAOException;
import com.farmcode.base.manager.FacadeException;

import com.farmcode.console.api.model.Status;
import com.farmcode.console.api.dao.StatusDAO;

import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author oiprado
 */
public class BaseStatusManagerBean  implements StatusManager {
  
	@EJB 
	StatusDAO statusDAO;


	public BaseStatusManagerBean(){

	}
	
	@Override
	public void create(Status entity) throws FacadeException {
	try {
			statusDAO.create(entity);
		} catch (DAOException ex) {
			throw new FacadeException(ex);
		}
	}

	@Override
	public void store(Status entity) throws FacadeException {
		try {
			statusDAO.store(entity);
		} catch (DAOException ex) {
			throw new FacadeException(ex);
		}
	}

	@Override
	public void remove(Status entity) throws FacadeException {
		try {
			statusDAO.remove(entity, entity.getId());
		} catch (DAOException ex) {
			throw new FacadeException(ex);
		}
	}

	@Override
	public List<Status> find() throws FacadeException {
		try {
			return statusDAO.find();
		} catch (DAOException ex) {
			throw new FacadeException(ex);
		}
	}

	@Override
	public void setBaseFilter(BaseFilter baseFilter) {
		statusDAO.setFilter(baseFilter);
	}
}

